<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>BFC 测试</title>
    <!-- 为box 盒子设置一些属性 创建了BFC ，就能让你内部的元素都包含在其中，这样就不会出现子盒子溢出在父盒子的外面的情况了 -->
    <style>
        section {
            height: 150px;
        }

        .box {
            background-color: rgb(224, 206, 247);
            border: 5px solid rebeccapurple;
        }

        .box[style] {
            background-color: aliceblue;
            border: 5px solid steelblue;
        }

        .float {
            float: left;
            width: 200px;
            height: 100px;
            background-color: rgba(255, 255, 255, .5);
            border: 1px solid black;
            padding: 10px;
        }
    </style>
</head>

<body>
    <section>
        <div class="box">
            <div class="float">I am a floated box!</div>
            <p>I am content inside the container.</p>
        </div>
    </section>
    <section>
        <div class="box" style="overflow:auto">
            <div class="float">I am a floated box!</div>
            <p>I am content inside the <code>overflow:auto</code> container.</p>
        </div>
    </section>
    <section>
        <div class="box" style="display:flow-root">
            <div class="float">I am a floated box!</div>
            <p>I am content inside the <code>display:flow-root</code> container.</p>
        </div>
    </section>
</body>

</html>